import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:ct_pa_majordomo/widgets/divider/solid_divider.dart";
import "package:flutter/material.dart";


class ListItem extends StatelessWidget {
  final Map lock;

  const ListItem({
    super.key,
    required this.lock,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.fromLTRB(12, 12, 16, 12),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(8),
        boxShadow: const [ThemeVars.boxShadow],
        color: Colors.white,
      ),
      child: Column(
        children: [
          Row(
            children: [
              Container(
                alignment: Alignment.center,
                padding: const EdgeInsets.all(4),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(4),
                  color: ThemeVars.colorPrimaryLight,
                ),
                child: const Text(
                  "房间",
                  style: TextStyle(
                    color: ThemeVars.colorPrimary,
                    fontSize: 10,
                    height: 1,
                    fontWeight: FontWeight.w500,
                  ),
                ),
              ),
              const SizedBox(width: 8,),
              Text(
                lock["name"],
                style: const TextStyle(
                  color: ThemeVars.colorText,
                  fontSize: 14,
                  fontWeight: FontWeight.w600,
                ),
              ),
            ],
          ),
          const SolidDivider(padding: EdgeInsets.symmetric(vertical: 8),),
          Row(
            children: [
              Text(
                lock["number"],
                style: const TextStyle(
                  fontSize: 14,
                ),
              ),
              // const SizedBox(width: 5,),
              // const Text(
              //   "(Wi-Fi)",
              //   style: TextStyle(
              //     fontSize: 14,
              //   ),
              // ),
            ],
          ),
          const SizedBox(height: 4,),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              // Text(
              //   "分组一",
              //   style: TextStyle(
              //     fontSize: 14,
              //   ),
              // ),
              Row(
                children: [
                  Text("电表度数：${lock["totalKwh"]}", style: const TextStyle(fontSize: 12, color: ThemeVars.colorTextTer),),
                ],
              )
            ],
          )
        ],
      ),
    );
  }

}